/**
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.painting.views;

import java.util.logging.Logger;

import com.hercules.android.receiver.LogUtil;

import android.content.Context;
import android.graphics.Canvas;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.AbsoluteLayout;

/**
 * @author Administrator
 *
 */
public class FlashEmbedWebView extends WebView {
	
	 /**
     * Represents the logger.
     * <p>
     * Can be any value, accessed by setter.
     */
    private static Logger logger = LogUtil.getLogger(FlashEmbedWebView.class.getSimpleName());
    
	public FlashEmbedWebView(Context context) {
		super(context);
	}

	@Override 
    protected boolean drawChild (Canvas canvas, View child, long drawingTime) {
	     if (child.getClass().getName().equals("com.adobe.flashplayer.FlashPaintSurface")) {
	    	 LogUtil.info(logger, this, "drawChild", "flash painted");
	    //	 child.setVisibility(INVISIBLE);
	    //	 ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams(10, 10);
	    //	 child.setLayoutParams(layout);
	    	 child.scrollTo(0, 0);
	     }

        return super.drawChild(canvas, child, drawingTime);
    }

	@Override
	public void setLayoutParams(ViewGroup.LayoutParams params) {
		super.setLayoutParams(params);
		
		for (int i = 0; i < this.getChildCount(); ++i) {
			View child = this.getChildAt(i);
			child.setLayoutParams(params);
		}
	}

}
